/* eslint-disable no-undef */
(function ($) {
  const _$exportExcelModal = $("#modal-export-excel");
  const _$exportExcelForm = _$exportExcelModal.find("form");
  //导出excel模块
  $("#exportExcelBtn").on("click", function () {
    let textArr = [];
    _$exportExcelForm.find("select").each(function () {
      textArr.push($(this).find("option:selected").text());
    });
    Swal.fire({
      title: `确定要导出以下范围的excel表格吗`,
      text: `操作时间范围:${textArr[0]},操作:${textArr[1]},条数:${textArr[2]}`,
      type: 'info',
      showCancelButton: true,
      confirmButtonColor: '#3085d6',
      cancelButtonColor: '#dc3545',
      cancelButtonText: '取消',
      confirmButtonText: '确定'
    }).then((result) => {
      if (result.value) {
        _$exportExcelForm.submit();
      }
    });
  });
  // 关闭导出excel模态框重置表单
  _$exportExcelModal.on('hidden.bs.modal', () => {
    _$exportExcelForm[0].reset();
  });
  // 监听lightbox
  $(document).on('click', '[data-toggle="lightbox"]', function (event) {
    event.preventDefault();
    $(this).ekkoLightbox({
      alwaysShowClose: true
    });
  });
})(jQuery);